<ix-page-header>
  <ix-search-input1 [value]="filterString" (search)="onListFiltered($event)"></ix-search-input1>

  <ix-table-columns-selector
    [columnPreferencesKey]="'cronList'"
    [columns]="columns"
    (columnsChange)="columnsChange($event)"
  ></ix-table-columns-selector>

  <button *ixRequiresRoles="requiredRoles" mat-button color="primary" ixTest="add-cronjob" (click)="doAdd()">
    {{ 'Add' | translate }}
  </button>
</ix-page-header>

<ix-table
  class="table"
  [ix-table-empty]="!(dataProvider.currentPageCount$ | async)"
  [ixUiSearch]="searchableElements.elements.cron"
  [emptyConfig]="emptyService.defaultEmptyConfig(dataProvider.emptyType$ | async)"
>
  <thead
    ix-table-head
    [columns]="columns"
    [dataProvider]="dataProvider"
  ></thead>
  <tbody
    ix-table-body
    [columns]="columns"
    [dataProvider]="dataProvider"
    [isLoading]="!!(dataProvider.isLoading$ | async)"
  >
    <ng-template let-cronjob ix-table-details-row [dataProvider]="dataProvider">
      <ix-table-details-row [hiddenColumns]="hiddenColumns" [row]="cronjob">
        <div class="table-details-row-actions">
          <button
            *ixRequiresRoles="requiredRoles"
            mat-button
            [ixTest]="[cronjob.id, 'run_now']"
            (click)="runNow(cronjob)"
          >{{ 'Run Now' | translate }}</button>
          <button
            mat-button
            [ixTest]="[cronjob.id, 'edit']"
            (click)="doEdit(cronjob)"
          >{{ 'Edit' | translate }}</button>
          <button
            *ixRequiresRoles="requiredRoles"
            mat-button
            [ixTest]="[cronjob.id, 'delete']"
            (click)="doDelete(cronjob)"
          >{{ 'Delete' | translate }}</button>
        </div>
      </ix-table-details-row>
    </ng-template>
  </tbody>
</ix-table>
<ix-table-pager [dataProvider]="dataProvider"></ix-table-pager>
